<?php

namespace App;
use Illuminate\Foundation\Auth\User as AuthUser;

class User extends AuthUser
{
    //白名单
    protected $fillable = ['name','email','password','openid'];

    protected $rememberTokenName = '';

    public function question()
    {
        return $this->hasMany("App\Question");
    }
    public function answer()
    {
        return $this->hasMany("App\Answer");
    }
    public function collect()
    {
        return $this->hasMany("App\Collect");
    }
    //关于我的消息提醒
    public function msg()
    {
        return $this->hasMany("App\Msg",'target_id','id');
    }

    public function mysign()
    {
        return $this->hasOne('App\Sign');
    }

    public function theSign()
    {
        $user = User::where('id',\Auth::id())->first();
        $sign_time = strtotime($user->mysign->created_at);
        if ($sign_time+86400>time()){
            return false;
        }else{
            return true;
        }
    }



}
